<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
    <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta content="" name="description" />
    <meta content="webthemez" name="author" />
    <title>公务交通申请表</title>
    <!-- Bootstrap Styles-->
    <link href="../assets/css/bootstrap.css" rel="stylesheet" />
    <!-- FontAwesome Styles-->
    <link href="../assets/css/font-awesome.css" rel="stylesheet" />

    <link href="../assets/css/select2.min.css" rel="stylesheet" >
    <link href="../assets/css/checkbox3.min.css" rel="stylesheet" >
    <!-- Custom Styles-->
    <!-- <link href="assets/css/custom-styles.css" rel="stylesheet" />-->
    <!-- Google Fonts-->
    <link href='https://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css' />
    <link rel="stylesheet" href="../js/layui/css/layui.css">
    <script src="../js/layui/layui.js"></script>
	<link rel="stylesheet" href="../css/img.css">
</head>
<body>


<!--/. NAV TOP  -->

<div id="page-wrapper" >
    <br /><br /><br />
    <div style="margin-left:-3%;">
    <div class="panel-body">
        <form class="form-inline">
            <div class="form-group" style="margin-left: 3%;">
                <label for="exampleInputName2">选择接收人角色:</label>
               <select class="selectbox" id="roleId"><!-- 这里是第一个下拉框的位置   角色 -->
                <option value="">请选择</option>
                	<c:forEach items="${roleNameList }" var="role">
	                <option value="${role.roleId}">${role.roleName }</option>
	                </c:forEach>
	        </select>
            </div>
           <div class="form-group" style="margin-left: 1%;">
                <label for="exampleInputName2">选择接收人:</label>
                <select class="selectbox"  id="userId">
	                <option value="">请选择</option>
	               
	        </select>
            </div>
        <a href="#" class="btn btn-success"  id="apply">申请</a>
        <a href="${pageContext.request.contextPath}/chooseApplication/chooseType.do" class="btn btn-info">返回</a>
        <a href="#" class="btn btn-warning example">查看示例</a>
        </form>
    </div>
    </div>
    <div class="header">
        <h1 class="page-header" style="text-align: center">
            公务交通 <small>（员工个人）</small>
        </h1>

    </div>


    <!-- <div id="page-inner"> -->
    <div class="row">
        <div class="col-xs-12">
            <div class="panel panel-default">
                <div class="panel-heading">
                    <div class="card-title">
                        <div class="title">基本信息</div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="row">
        <div class="col-xs-12">
            <div class="panel panel-default">
                <div class="panel-heading">
                    <div class="card-title">
                        <div class="title">
                            <div class="panel panel-default">
                                <!--<div class="panel-heading">
                                    Basic Table
                                </div>-->
                                <div class="panel-body">
                                    <div class="table-responsive">
                                        <table class="table">
										 <c:forEach items="${basicList }" var="basic">
                                            <tr>
                                                <td style="text-align: right;">
                                                   	 报账人：
                                                </td>
                                                <td>
                                                  ${basic.userName }
                                                </td>

                                                <td style="text-align: right;">
                                                    	报账单位名称：
                                                </td>
                                                <td>
                                                    ${basic.departmentName }
                                                </td>
                                                <td style="text-align: right;">
                                                	报账人电话：
                                                </td>
                                                <td>
                                                     ${basic.phone }
                                                </td>
                                            </tr>
                                            <tr>
											    <td style="text-align: right;">
                                                   	 公司代码：
                                                </td>
                                                <td>
                                                   ${basic.companyId }
                                                </td> 
                                                <td style="text-align: right;">
                                                   	 预算指标：
                                                </td>
                                                <td>
                                                    	差旅费
                                                </td>
                                                <td style="text-align: right;">发票类型：</td>
                                                <td>
                                                    <div class="form-group" style="margin-left: 3%;">
													<select class="selectbox" id="invoiceTypeId">
														<c:forEach items="${invoiceTypeList }" var="invoiceType"> 
															<option value="${invoiceType.invoiceTypeId }">${invoiceType.invoiceTypeName }</option>
														</c:forEach>
													</select>
													</div>
                                                </td>
                                                
                                            </tr>
                                            <tr>
                                                <td style="text-align: right;">
                                                   	 报账单号：
                                                </td><!-- 通过js生成唯一id作为报销表id -->
                                                <td>
                                                    <input type="text"  onfocus="this.blur();" class="form-control input-sm" aria-controls="dataTables-example"  id="makeId" value="">
                                                </td>
                                                <td style="text-align: right;">
                                                    	报账时间：
                                                </td>
                                                <td>
                                                    <input type="date" class="form-control" class="exampleInputName2" id="reimbursementTime">
                                                </td>
                                                <td style="text-align: right;">费用发生日：</td>
                                                <td>
                                                    <input type="date" class="form-control" class="exampleInputName2" id="invoiceTime" onblur="costDay(this)">
                                                </td>
												
                                            </tr>
                                            <tr >
											    <td style="text-align: right;">
                                                  	  收支方式：
                                                </td>
                                                <td>
                                                    <input type="text" class="form-control input-sm" id="payments" onblur="payment(this)">
                                                </td> 
                                                <td style="text-align: right;">
                                                    	是否员工代垫：
                                                </td>
                                                <td>
                                                    <input type="text" class="form-control input-sm" id="isAdvance" onblur="advance(this)">
                                                </td>
                                                <td style="text-align: right;">
                                                   	 是否个人专项：
                                                </td>
                                                <td>
                                                    <input type="text" class="form-control input-sm"  id="isSingle" onblur="single(this)">
                                                </td>
                                            </tr>
                                            <tr>
                                                <td style="text-align: right;">
                                                  	  附单据张数：
                                                </td>
                                                <td>
                                                    <input type="text" class="form-control input-sm"  id="reimbursementNumber" onblur="number(this)">
                                                </td>
                                                <td style="text-align: right;">
                                                    	报账说明：
                                                </td>
                                                <td colspan="3">
                                                    <input type="text" class="form-control input-sm"   id="reimbursementExplain">
                                                </td>
                                            </tr>
                                            </c:forEach>
                                        </table>
                                    </div>
                                </div>
                            </div>

                        </div>
                    </div>
                </div>
                <div class="panel-body">

                </div>
            </div>
        </div>
    </div>
    <div class="row">
        <div class="col-xs-12">
            <div class="panel panel-default">
                <div class="panel-heading">
                    <div class="card-title">
                        <div class="title">明细信息</div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="row">
        <div class="col-xs-12">
            <div class="panel panel-default">
                <div class="panel-heading">
                    <div class="card-title">
                        <div class="title">
                            <div class="panel panel-default">
                                <!--<div class="panel-heading">
                                    Kitchen Sink
                                </div>-->
                                <div class="panel-body">
                                    <div class="table-responsive">
                                        <table class="table table-striped table-bordered table-hover">
                                            <thead>
                                            <tr>
                                                <th>是否使用成本/资本预算</th> 
                                                <th>预算责任中心</th>
												<th>记账成本中心</th>
                                                <th>报款金额（含税）</th>
                                                <th>报款金额</th>
                                            </tr>
                                            </thead>
                                            <tbody>
                                            <c:forEach items="${basicList }" var="basic">
                                            <tr>
                                                <td>
                                                    <input type="text" class="form-control" placeholder="是否使用成本/资本预算"  id="isCostCapitalBudget" onblur="costCapitalBudget(this)">
                                                </td>
                                                <td>
                                                    <input type="text" class="form-control"placeholder="预算责任中心" value="${basic.departmentName }" onfocus="this.blur();">
                                                </td>
												<td>
                                                    <input type="text" class="form-control" placeholder="记账成本中心" value = "" onfocus="this.blur();" id="accounting">
                                                </td>
                                                <td>
                                                    <input type="text" class="form-control"  placeholder="报款金额（含税）" id="reimbursementMoney" onblur="reimbursementmoney(this)">
                                                </td>
                                                <td>
                                                    <input type="text" class="form-control"  placeholder="报款金额"  id="Money" onblur="money(this)">
                                                </td>
                                            </tr>
												</c:forEach>
                                            </tbody>
                                        </table>
                                    </div>
                                </div>
                            </div>

                        </div>
                    </div>
                </div>
                <div class="panel-body">

                </div>
            </div>
        </div>
    </div>
    <div class="row">
        <div class="col-xs-12">
            <div class="panel panel-default">
                <div class="panel-heading">
                    <div class="card-title">
                        <div class="title">其他</div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="row">
        <div class="col-xs-12">
            <div class="panel panel-default">
                <div class="panel-heading">
                    <div class="card-title">
                        <div class="title">
                            <!--选项卡-->
                            <div class="panel panel-default">

                                <div class="panel-body">
                                    <ul class="nav nav-tabs">
                                        <li class=""><a href="#home" data-toggle="tab" aria-expanded="false">内部人信息</a>
                                        </li>
                                        <li class="active"><a href="#profile" data-toggle="tab" aria-expanded="true">报账单影像</a>
                                    </ul>

                                    <div class="tab-content">
                                        <div class="tab-pane fade" id="home">


                                            <!--表格-->
                                            <div class="panel panel-default">
                                                <!--   <div class="panel-heading">
                                                       Bordered Table
                                                   </div>-->

                                                <!-- /.panel-heading -->
                                                <div class="panel-body">
                                                    <div class="table-responsive table-bordered">
                                                        <table class="table">
                                                            <thead>
                                                            <tr>
                                                                <th>序号</th>
                                                                <th>收款人</th>
                                                                <th>所属部门</th>
                                                                <th>员工编号</th>
                                                                <th>收款类型</th>
                                                                <th>公司名称</th>
                                                                <th>开户行</th>
                                                                <th>银行账号</th>
                                                                <th>金额</th>
                                                            </tr>
                                                            </thead>
                                                            <tbody>
                                                            <tr>
                                                                <td>1</td>
                                                               <td>
                                                                    ${otherMessage.userName}
                                                                </td>

                                                                <td>
																	${otherMessage.departmentName }
                                                                </td>
                                                                <td>
                                                                    ${otherMessage.userId }
                                                                </td>
                                                                <td>
                                                                	${otherMessage.receivablesType }
                                                                </td>
                                                                <td>
																	${otherMessage.companyName }
                                                                </td>
                                                                <td>
																	${otherMessage.bankName }
                                                                </td>
                                                                <td>
																	${otherMessage.bankNumber }

                                                                </td>
                                                                <td>
                                                                    <input type="text" class="form-control" class="exampleInputName2" placeholder="金额"  id="reMoney" onfocus="this.blur();">

                                                                </td>

                                                            </tr>

                                                            </tbody>
                                                        </table>
                                                    </div>
                                                </div>
                                            </div>
                                            <!--
                                                作者：1049794100@qq.com
                                                时间：2018-01-04
                                                描述：表格
                                            -->
                                        </div>
                                        <div class="tab-pane fade active in" id="profile">
                                            <div class="layui-upload">
                                                <button type="button" class="layui-btn layui-btn-normal" id="testList">选择多文件</button>
                                                <div class="layui-upload-list">
                                                    <table class="layui-table">
                                                        <thead>
                                                        <th>文件名</th>
                                                        <th>大小</th>
                                                        <th>状态</th>
                                                        <th>操作</th>
                                                        </thead>
                                                        <tbody id="demoList"></tbody>
                                                    </table>
                                                </div>
												   <blockquote class="layui-elem-quote layui-quote-nm" style="margin-top: 10px;">
														预览图：
														<div class="layui-upload-list" id="demo2"></div>
													</blockquote>
                                                <button type="button" class="layui-btn" id="testListAction">开始上传</button>
                                            </div>
                                        </div>

</div>
</div>
</div>
</div>
</div>
</div>

</div>
</div>
</div>

</div>

<!-- JS Scripts-->
<!-- jQuery Js -->
<script src="../assets/js/jquery-1.10.2.js"></script>
<!-- Bootstrap Js -->
<script src="../assets/js/bootstrap.min.js"></script>
<!-- Metis Menu Js -->
<script src="../assets/js/jquery.metisMenu.js"></script>
<script src="../assets/js/select2.full.min.js"></script>
<script type="text/javascript">
    $(document).ready(function() {
        $(".selectbox").select2();
    });

    //查看示例
    layui.use('layer', function(){
        var layer = layui.layer;
    });
    $('.example').on('click', function(){
        layer.open({
            type: 2,
            title: '公务交通示例',
            maxmin: true,
            shadeClose: false, //点击遮罩关闭层
            area : ['80%' , '80%'],
            content: ['${pageContext.request.contextPath}/chooseApplication/applyDemo.do?reimbursementName=officialtrafficDemo','yes']
        });
    });
</script>
<!-- Custom Js -->
<!-- <script src="../../assets/js/custom-scripts.js"></script>-->
<!-- 这里需要点击角色名称 获取到当前角色id  然后通过ajax去后台找当前角色的用户 -->
    </script>
    
		<!-- 这里需要点击角色名称 获取到当前角色id  然后通过ajax去后台找当前角色的用户 -->
	<script type="text/javascript">
		$("#roleId").on("change",function(){
			var roleId = this.value;//当前的角色id
			console.log(roleId);
			console.log("11111");
			$.ajax({
				type:"post",
				url:"${pageContext.request.contextPath}/offcialTrafficApplication/listUserNameAll.do",
				dataType:"json",
				data:{"roleId":roleId},
				success:function(data){
					console.log("成功了");
					if(data == null || data == ""){
						console.log("没数据");
						$("#userId").children().remove();
					}else {
						var str = "";
						$("#userId").children().remove();
						$.each(data,function(key,val){
							str += '<option value='+ val.userId +'>'+val.userName+'</option>';
							console.log(key);
							console.log("-----");
							console.log(val);
						});
						$("#userId").append(str);
					}
				},
				error:function(data){
					console.log(data);
				}
			});
		});
		
		//生成唯一的报销id
		function getId(){
			var date = new Date();
			var year = date.getFullYear();
			var month = date.getMonth();
			var day = date.getDate();
			var hour = date.getHours();
			var minute = date.getMinutes();
			var second = date.getSeconds(); 
			var id = "";
			id = year.toString()+month.toString()+day.toString()+hour.toString()+minute.toString()+second.toString();
			return id;
		}
		 
		//在报销单号处显示报销id
		//进入界面就生成了唯一的报销id
		window.onload = function makeId(){
			
			var getid = getId();
			var reId = document.getElementById("makeId");//得到位置
			reId.value = getid;
			
		}
		
		//得到报销金额，并将金额赋值给内部收款人的金额
		$("#Money").blur(function(){
			//console.log($(this).val());
			var m = $(this).val();//当前输入框的金额
			//将此金额赋值给内部人信息的金额
			$("#reMoney").val(m);
		});
		
		//选择发送人，显示记账成本中心，根据发送人id，查找部门名
		var userIdDept = document.getElementById("userId");
		userIdDept.onchange=function(){
		var userId = userIdDept.options[userIdDept.selectedIndex].value;
			//console.log(userId);
		$.ajax({
			type:"post",
			url:"${pageContext.request.contextPath}/offcialTrafficApplication/getDeptName.do",
			dataType:"json",
			data:{"userId":userId},
			success:function(data){
				//console.log(data.deptName);
				$("#accounting").val(data.deptName);
			},
			error:function(){
				//console.log("我错了");
			}
		});
	}
		
		//点击申请获取界面信息，新增报销信息
		$("#apply").click(function(){
			var userId = $('#userId option:selected').val();//接收者id
			var invoiceTypeId = $('#invoiceTypeId option:selected').val();//票据类型id
			var reimbursementId = $("#makeId").val();//报销id
			var reimbursementTime =$("#reimbursementTime").val();//报销时间(报账时间)
			var reimbursementExplain = $("#reimbursementExplain").val();//报销说明
			var payments = $("#payments").val();//收支方式
			var invoiceTime = $("#invoiceTime").val();//票据时间(费用发生时间)
			var isAdvance = $("#isAdvance").val() ;//是否员工垫付
			var reimbursementNumber = $("#reimbursementNumber").val();//附单据张数
			var isCostCapitalBudget =$("#isCostCapitalBudget").val() ;//是否使用成本预算
			var reimbursementMoney = $("#reimbursementMoney").val();//报销总金额
			var reimbursementMoneyOfTax =$("#money").val() ;//报销总金额(含税)
			var isSingle = $("#isSingle").val();//是否个人专项
			//console.log(typeof userId);
			//console.log(invoiceTypeId);
			//console.log(typeof reimbursementId);
			//console.log(typeof reimbursementTime);
			//console.log(typeof reimbursementExplain);
			//console.log(typeof payments);
			//console.log(typeof invoiceTime);
			//console.log(typeof isAdvance);
			//console.log(typeof reimbursementNumber);
			//console.log(typeof isCostCapitalBudget);
			//console.log(typeof reimbursementMoney);
			//console.log(typeof reimbursementMoneyOfTax);
			console.log(isSingle);
			
		if(userId !='' && invoiceTypeId != '' && reimbursementId != '' && reimbursementTime != '' && reimbursementTime != '' && reimbursementExplain != '' && payments != ''
				&& invoiceTime != '' &&  isAdvance != '' && reimbursementNumber != '' && isCostCapitalBudget != '' && reimbursementMoney != '' && reimbursementMoneyOfTax != '' && isSingle != ''){
			var jsonMsg = {
					"userId":userId,
					"invoiceTypeId":invoiceTypeId,
					"reimbursementId":reimbursementId,
					"reimbursementTime":reimbursementTime,
					"reimbursementExplain":reimbursementExplain,
					"payments":payments,
					"invoiceTime":invoiceTime,
					"isAdvance":isAdvance,
					"reimbursementNumber":reimbursementNumber,
					"isCostCapitalBudget":isCostCapitalBudget,
					"reimbursementMoney":reimbursementMoney,
					"reimbursementMoneyOfTax":reimbursementMoneyOfTax,
					"isSingle":isSingle
					
				}
				
				$.ajax({
					type:"post",
					url:"${pageContext.request.contextPath}/offcialTrafficApplication/insertOffcialMsg.do",
					dataType:"json",
					data:jsonMsg,
					contentType: "application/x-www-form-urlencoded",
					success:function(data){
						//console.log(data);
						if(data != 0){
							layer.msg("新增成功！");
						}else{
							layer.msg("新增失败！");
						}
					},
					error:function(){
						console.log("我错了");
					}
				});
			}else{
				 layer.msg("数据不完整，请填写完整后提交！");
			}
		
		});
	</script>
	<script>
	 //$("#testList").on("blur",function(){
		 /* function extra_data(input, data){
			 var item=[];
				$.each(data,function(k,v){
					item.push('<input type="hidden" name="'+k+'" value="'+v+'">');
				})
				$(input).after(item.join(''));
		 } */
		    layui.use('upload', function(){// 如果只加载一个模块，可以不填数组。如：layui.use('form')
		        var $ = layui.jquery 
		                ,upload = layui.upload; //获取upload模块
		        //多文件列表示例
		        var demoListView = $('#demoList')
		                ,uploadListIns = upload.render({
		                    elem: '#testList' //指定原始元素，默认直接查找class="layui-upload-file"
		                    ,url: '${pageContext.request.contextPath}/upload/uploadFile.do' //请求地址
		                    ,accept: 'file' //上传文件类型
		                    ,size: 51200 //最大允许上传文件大小  kb
		                    ,multiple: true //是否支持多文件上传
		                    ,auto: false //文件选择后是否自动上传
		                    ,bindAction: '#testListAction' //上传按钮
		                    ,before: function(input){
		                    	//请求上传接口的额外参数
		                    	var data = {"invoiceTime":$("#invoiceTime").val(),
			                    	"invoiceTypeId":$('#invoiceTypeId option:selected').val()
			                    	,"reimbursementId":$("#makeId").val()};
		                    	this.data = data;
		                    	/* console.log(data);
		                    	extra_data(input,data); */
		                    }
		                    ,choose: function(obj){//选择文件后的回调函数。返回一个object参数
		                        var files = this.files = obj.pushFile(); //将每次选择的文件追加到文件队列
		                        //读取本地文件
		                        obj.preview(function(index, file, result){
		                            var tr = $(['<tr id="upload-'+ index +'">'
		                                ,'<td>'+ file.name +'</td>'
		                                ,'<td>'+ (file.size/1014).toFixed(1) +'kb</td>'
		                                ,'<td>等待上传</td>'
		                                ,'<td>'
		                                ,'<button class="layui-btn layui-btn-mini demo-reload layui-hide">重传</button>'
		                                ,'<button class="layui-btn layui-btn-mini layui-btn-danger demo-delete">删除</button>'
		                                ,'</td>'
		                                ,'</tr>'].join(''));

		                            //图片预览
		                            $('#demo2').append('<img src="'+ result +'" alt="'+ file.name +'" class="yulanimg" id="img-'+ index +'">')

		                            //单个重传
		                            tr.find('.demo-reload').on('click', function(){
		                                obj.upload(index, file);
		                            });

		                            //删除
		                            tr.find('.demo-delete').on('click', function(){
		                                delete files[index]; //删除对应的文件
		                                tr.remove();
		                                console.log(index);
		                                var str ='#img-'+index;
		                                console.log(str);
		                                $(str).remove()
		                                uploadListIns.config.elem.next()[0].value = ''; //清空 input file 值，以免删除后出现同名文件不可选
		                            });

		                            demoListView.append(tr);
		                        });
		                    }
		                    ,done: function(res, index, upload){//上传完毕回调
		                        if(res.code == 0){ //上传成功
		                            var tr = demoListView.find('tr#upload-'+ index)
		                                    ,tds = tr.children();
		                            tds.eq(2).html('<span style="color: #5FB878;">上传成功</span>');
		                            tds.eq(3).html(''); //清空操作
		                            return delete this.files[index]; //删除文件队列已经上传成功的文件
		                        }
		                        this.error(index, upload);
		                    }
		                    ,error: function(index, upload){//执行上传请求出现异常的回调
		                        var tr = demoListView.find('tr#upload-'+ index)
		                                ,tds = tr.children();
		                        tds.eq(2).html('<span style="color: #FF5722;">上传失败</span>');
		                        tds.eq(3).find('.demo-reload').removeClass('layui-hide'); //显示重传
		                    }
		                });

		    });
	 //});
	 
	 //判断费用发生日是否在报账时间之前
	 function costDay(invoiceTime) {
		 //费用发生日
		 var $invoiceTime = $(invoiceTime);
		 //报账时间
		 var $reimbursementTime = $(reimbursementTime);
		 var reimbursementTime = $invoiceTime.parents("td").prev().prev().find("input").val();
		 //将报销时间转化为数字
		 var reimNum = parseInt(reimbursementTime.replace(/-/g, ''), 10);
		 //将费用发生日转化为数字
		 var invoiceTime = $invoiceTime.val();
		 var invoiceNum = parseInt(invoiceTime.replace(/-/g, ''), 10);
		 //判断费用发生日和报账时间的先后顺序
		 var day = reimNum - invoiceNum;
		 if(invoiceTime == "" || reimbursementTime == "") {
			 layer.msg("报账时间和费用发生日不能为空");
		 } else if(reimNum < invoiceNum) {
			 layer.msg("报账时间不能在费用发生日之前");
			 $invoiceTime.val("");
			 $invoiceTime.parents("td").prev().prev().find("input").val("");
		 }
	 }
	 //是否员工代垫
	 function advance(isAdvance) {
		 var $isAdvance = $(isAdvance);
		 var isAdvance = $isAdvance.val();
		 if(isAdvance != "是" && isAdvance != "否") {
			 layer.msg("请输入“是”或“否”");
			 $isAdvance.val("");
		 }
	 }
	 //是否个人专项
	 function single(isSingle) {
		 var $isSingle = $(isSingle);
		 var isSingle = $isSingle.val();
		 if(isSingle != "是" && isSingle != "否") {
			 layer.msg("请输入“是”或“否”");
			 $isSingle.val("");
		 }
	 }
	 //是否成本/资本预算
	 function costCapitalBudget(isCostCapitalBudget) {
		 var $isCostCapitalBudget = $(isCostCapitalBudget);
		 var isCostCapitalBudget = $isCostCapitalBudget.val();
		 if(isCostCapitalBudget != "是" && isCostCapitalBudget != "否") {
			 layer.msg("请输入“是”或“否”");
			 $isCostCapitalBudget.val("");
		 }
	 }
	 //判断收支方式
	 function payment(payments) {
		 var $payments = $(payments);
		 var payments = $payments.val();
		 if(payments != "现金支付" && payments != "集中支付" && payments != "支付宝支付" && payments != "微信支付") {
			 layer.msg("请输入“现金支付”、“集中支付”、“支付宝支付”、“微信支付”中的一种");
			 $payments.val("");
		 }
	 }
	 //判断附单据张数是否为数字
	  function number(reimbursementNumber) {
		 var $reimbursementNumber = $(reimbursementNumber);
		 var reimbursementNumber = $reimbursementNumber.val();
		 if(isNaN(reimbursementNumber) == true) {
			 layer.msg("请输入数字");
			 $reimbursementNumber.val("");
		 } else if(reimbursementNumber <= 0) {
			 layer.msg("请输入大于零的数");
			 $reimbursementNumber.val("");
		 } else if(parseInt(reimbursementNumber) != reimbursementNumber) {
			 layer.msg("请输入大于零的整数");
			 $reimbursementNumber.val("");
		 }
	 } 
	 //报款金额(含税)
	 function reimbursementmoney(reimbursementMoney) {
		 var $reimbursementMoney = $(reimbursementMoney);
		 var reimbursementMoney = $reimbursementMoney.val();
		 if(isNaN(reimbursementMoney) == true) {
			 layer.msg("请输入数字");
			 $reimbursementMoney.val("");
		 } else if(reimbursementMoney <= 0) {
			 layer.msg("请输入大于零的数");
			 $reimbursementMoney.val("");
		 }
	 }
	 //报款金额 
	 function money(Money) {
		 var $Money = $(Money);
		 var Money = $Money.val();
		 if(isNaN(Money) == true) {
			 layer.msg("请输入数字");
			 $Money.val("");
		 } else if(Money <= 0) {
			 layer.msg("请输入大于零的数");
			 $Money.val("");
		 } else if (reimbursementMoney < Money){
			 layer.msg("报款金额（含税）不能小于报款金额");
			 $reimbursementMoney.val("");
			 $Money.val("");
		 }
	 }
	</script>
</html>